Skip to content

feat: Make most Feature fields optional#69

Merged
rolodato merged 1 commit intomainfrom
feat/optional-feature-fields
Jul 8, 2025
Merged

feat: Make most Feature fields optional#69
rolodato merged 1 commit intomainfrom
feat/optional-feature-fields

Conversation

@rolodato
Copy link
Copy Markdown
Contributor

@rolodato rolodato commented Jul 6, 2025

Currently, defining default flags requires passing a list of Flags. Each flag contains a Feature, which has many unnecessary fields when it comes to defining default flags:

id
createdDate
description
type
defaultEnabled
initialValue

This PR makes all of these fields optional, so that default flags can be defined like this:

val defaultFlags = listOf(
    Flag(
        feature = Feature(
            name = "Flag 1",
        ),
        enabled = true,
        featureStateValue = "value1"
    ),
    Flag(
        feature = Feature(
            name = "Flag 2",
        ),
        enabled = true,
        featureStateValue = "value2"
    ),
)

instead of:

val defaultFlags = listOf(
    Flag(
        feature = Feature(
            id = 345345L,
            name = "Flag 1",
            createdDate = "2023‐07‐07T09:07:16Z",
            description = "Flag 1 description",
            type = "CONFIG",
            defaultEnabled = true,
            initialValue = "true"
        ), enabled = true, featureStateValue = "value1"
    ),
    Flag(
        feature = Feature(
            id = 34345L,
            name = "Flag 2",
            createdDate = "2023‐07‐07T09:07:16Z",
            description = "Flag 2 description",
            type = "CONFIG",
            defaultEnabled = true,
            initialValue = "true"
        ), enabled = true, featureStateValue = "value2"
    ),
)

@rolodato rolodato merged commit dcb4afb into main Jul 8, 2025
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants